#pragma once
//#include "passwordCollection.h"
//#include "passwordGenerator.h"
//#include <msclr\marshal.h>
#include <stdlib.h>
#include <msclr\marshal_cppstd.h>
namespace passwordContainer {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	
	/// <summary>
	/// Summary for mainWindow
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class mainWindow : public System::Windows::Forms::Form
	{
	public:
		mainWindow(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~mainWindow()
		{
			if (components)
			{
				delete components;
			}
		}
    private: System::Windows::Forms::MenuStrip^  menuStrip1;
    protected: 
    private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^  openPasswordFileToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^  savePasswordFileToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^  editToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^  setMasterPasswordToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^  helpToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^  aboutToolStripMenuItem;
    private: System::Windows::Forms::ToolStrip^  toolStrip1;
    private: System::Windows::Forms::ToolStripButton^  openPassFile;

    private: System::Windows::Forms::ToolStripButton^  closePassFile;

    private: System::Windows::Forms::ToolStripButton^  setMasPwd;
    private: System::Windows::Forms::OpenFileDialog^  openPasswordFileDialog;
    private: System::Windows::Forms::SaveFileDialog^  savePasswordFileDialog;
    //private: PASSWORDS::passwordCollection *pwdCollection;
    private: System::Data::DataSet^  passwordCollection;
    private: System::Windows::Forms::TableLayoutPanel^  tableLayoutPanel1;

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
            System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(mainWindow::typeid));
            this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
            this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
            this->openPasswordFileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
            this->savePasswordFileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
            this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
            this->editToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
            this->setMasterPasswordToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
            this->helpToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
            this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
            this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
            this->openPassFile = (gcnew System::Windows::Forms::ToolStripButton());
            this->closePassFile = (gcnew System::Windows::Forms::ToolStripButton());
            this->setMasPwd = (gcnew System::Windows::Forms::ToolStripButton());
            this->openPasswordFileDialog = (gcnew System::Windows::Forms::OpenFileDialog());
            this->savePasswordFileDialog = (gcnew System::Windows::Forms::SaveFileDialog());
            this->passwordCollection = (gcnew System::Data::DataSet());
            this->tableLayoutPanel1 = (gcnew System::Windows::Forms::TableLayoutPanel());
            this->menuStrip1->SuspendLayout();
            this->toolStrip1->SuspendLayout();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->passwordCollection))->BeginInit();
            this->SuspendLayout();
            // 
            // menuStrip1
            // 
            this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->fileToolStripMenuItem, 
                this->editToolStripMenuItem, this->helpToolStripMenuItem});
            resources->ApplyResources(this->menuStrip1, L"menuStrip1");
            this->menuStrip1->Name = L"menuStrip1";
            // 
            // fileToolStripMenuItem
            // 
            this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->openPasswordFileToolStripMenuItem, 
                this->savePasswordFileToolStripMenuItem, this->exitToolStripMenuItem});
            this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
            resources->ApplyResources(this->fileToolStripMenuItem, L"fileToolStripMenuItem");
            // 
            // openPasswordFileToolStripMenuItem
            // 
            resources->ApplyResources(this->openPasswordFileToolStripMenuItem, L"openPasswordFileToolStripMenuItem");
            this->openPasswordFileToolStripMenuItem->Name = L"openPasswordFileToolStripMenuItem";
            this->openPasswordFileToolStripMenuItem->Click += gcnew System::EventHandler(this, &mainWindow::openPassFile_Click);
            // 
            // savePasswordFileToolStripMenuItem
            // 
            resources->ApplyResources(this->savePasswordFileToolStripMenuItem, L"savePasswordFileToolStripMenuItem");
            this->savePasswordFileToolStripMenuItem->Name = L"savePasswordFileToolStripMenuItem";
            this->savePasswordFileToolStripMenuItem->Click += gcnew System::EventHandler(this, &mainWindow::closePassFile_Click);
            // 
            // exitToolStripMenuItem
            // 
            this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
            resources->ApplyResources(this->exitToolStripMenuItem, L"exitToolStripMenuItem");
            this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &mainWindow::exitToolStripMenuItem_Click);
            // 
            // editToolStripMenuItem
            // 
            this->editToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->setMasterPasswordToolStripMenuItem});
            this->editToolStripMenuItem->Name = L"editToolStripMenuItem";
            resources->ApplyResources(this->editToolStripMenuItem, L"editToolStripMenuItem");
            // 
            // setMasterPasswordToolStripMenuItem
            // 
            resources->ApplyResources(this->setMasterPasswordToolStripMenuItem, L"setMasterPasswordToolStripMenuItem");
            this->setMasterPasswordToolStripMenuItem->Name = L"setMasterPasswordToolStripMenuItem";
            // 
            // helpToolStripMenuItem
            // 
            this->helpToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->aboutToolStripMenuItem});
            this->helpToolStripMenuItem->Name = L"helpToolStripMenuItem";
            resources->ApplyResources(this->helpToolStripMenuItem, L"helpToolStripMenuItem");
            // 
            // aboutToolStripMenuItem
            // 
            this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem";
            resources->ApplyResources(this->aboutToolStripMenuItem, L"aboutToolStripMenuItem");
            // 
            // toolStrip1
            // 
            this->toolStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->openPassFile, this->closePassFile, 
                this->setMasPwd});
            resources->ApplyResources(this->toolStrip1, L"toolStrip1");
            this->toolStrip1->Name = L"toolStrip1";
            // 
            // openPassFile
            // 
            this->openPassFile->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
            resources->ApplyResources(this->openPassFile, L"openPassFile");
            this->openPassFile->Name = L"openPassFile";
            this->openPassFile->Click += gcnew System::EventHandler(this, &mainWindow::openPassFile_Click);
            // 
            // closePassFile
            // 
            this->closePassFile->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
            resources->ApplyResources(this->closePassFile, L"closePassFile");
            this->closePassFile->Name = L"closePassFile";
            this->closePassFile->Click += gcnew System::EventHandler(this, &mainWindow::closePassFile_Click);
            // 
            // setMasPwd
            // 
            this->setMasPwd->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
            resources->ApplyResources(this->setMasPwd, L"setMasPwd");
            this->setMasPwd->Name = L"setMasPwd";
            // 
            // openPasswordFileDialog
            // 
            this->openPasswordFileDialog->FileName = L"*.pwd";
            this->openPasswordFileDialog->InitialDirectory = L"D:/dev/svn/";
            resources->ApplyResources(this->openPasswordFileDialog, L"openPasswordFileDialog");
            // 
            // savePasswordFileDialog
            // 
            this->savePasswordFileDialog->Tag = L"pwd";
            resources->ApplyResources(this->savePasswordFileDialog, L"savePasswordFileDialog");
            // 
            // passwordCollection
            // 
            this->passwordCollection->DataSetName = L"NewDataSet";
            // 
            // tableLayoutPanel1
            // 
            resources->ApplyResources(this->tableLayoutPanel1, L"tableLayoutPanel1");
            this->tableLayoutPanel1->Name = L"tableLayoutPanel1";
            this->tableLayoutPanel1->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &mainWindow::tableLayoutPanel1_Paint);
            // 
            // mainWindow
            // 
            resources->ApplyResources(this, L"$this");
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->Controls->Add(this->tableLayoutPanel1);
            this->Controls->Add(this->toolStrip1);
            this->Controls->Add(this->menuStrip1);
            this->MainMenuStrip = this->menuStrip1;
            this->Name = L"mainWindow";
            this->menuStrip1->ResumeLayout(false);
            this->menuStrip1->PerformLayout();
            this->toolStrip1->ResumeLayout(false);
            this->toolStrip1->PerformLayout();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->passwordCollection))->EndInit();
            this->ResumeLayout(false);
            this->PerformLayout();

        }
#pragma endregion
private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) 
{
    this->Close();
}
private: System::Void openPassFile_Click(System::Object^  sender, System::EventArgs^  e) 
{
    // Set the file dialog to filter for graphics files.
    this->openPasswordFileDialog->Filter =
        "Files (*.pwd;*.txt;)|*.pwd;*.txt;|" +
        "All files (*.*)|*.*";

    // Allow the user to select multiple images.
    this->openPasswordFileDialog->Multiselect = false;
    this->openPasswordFileDialog->Title = "Open Password File";

    if ( openPasswordFileDialog->ShowDialog() == System::Windows::Forms::DialogResult::OK )
	{  
          String ^tempString = openPasswordFileDialog->FileName;
          //need #include <msclr\marshal.h>
          std::string stdString = msclr::interop::marshal_as<std::string>(tempString);  //String^ to std
         
        /*  pwdCollection = new PASSWORDS::passwordCollection(  );
          pwdCollection->setMasterPassword("test");
          pwdCollection->loadCollection( stdString );*/
      }

//private: loadDataSet(PASSWORDS::passwordCollection collection)
//{
//    
//}
    
}
private: System::Void closePassFile_Click(System::Object^  sender, System::EventArgs^  e) 
{
    // Set the file dialog to filter for graphics files.
    this->savePasswordFileDialog->Filter =
        "Files (*.pwd;)|*.pwd;|" +
        "All files (*.*)|*.*";

    // Allow the user to select multiple images.
    this->savePasswordFileDialog->Title = "Close Password File";
    savePasswordFileDialog->ShowDialog();
}
private: System::Void tableLayoutPanel1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) {
         }
};
}

